Read records from a database table

The folowing function opens a database connection and reads all records from a table

C# .NET

public static String DoTest()
{
         string strRet = "";
         try
         {
                  string path = @"c:\MyDir";
                  if (!Directory.Exists(path))
                  {
                           Directory.CreateDirectory(path);
                  }
                  else
                  {
                           // Take an action which will affect the write time.
                           Directory.SetLastWriteTime(path, new DateTime(1985,4,3));
                  }

                  // Get the creation time of a well-known directory.
                  DateTime dt = Directory.GetLastWriteTime(path);
                  strRet += String.Format("The last write time for this directory was {0}\r\n", dt);

                  // Update the last write time.
                  Directory.SetLastWriteTime(path, DateTime.Now);
                  dt = Directory.GetLastWriteTime(path);
                  strRet += String.Format("The last write time for this directory was {0}\r\n", dt);
         }
         catch (Exception e)
         {
                  strRet += String.Format("The process failed: {0}\r\n", e.ToString());
         }
         return strRet;
}

 

Blaze++ .NET

static String DoTest()
{
         String strRet = "";
         try
         {
                  String path = "c:\\MyDir";
                  if (!Directory::Exists(path))
                  {
                           Directory::CreateDirectory(path);
                  }
                  else
                  {
                           // Take an action which will affect the write time.
                           Directory::SetLastWriteTime(path, DateTime(1985,4,3));
                  }
                  // Get the creation time of a well-known directory.
                  DateTime dt = Directory::GetLastWriteTime(path);
                  strRet += String::Format("The last write time for this directory was {0}\r\n", dt);

                  // Update the last write time.
                  Directory::SetLastWriteTime(path, DateTime::Now);
                  dt = Directory::GetLastWriteTime(path);
                  strRet += String::Format("The last write time for this directory was {0}\r\n", dt);
         }
         catch (Exception e)
         {
                  strRet += String::Format("The process failed: {0}\r\n", e.ToString());
         }
         return strRet;
}